<template>
  <t-image-viewer v-if="!store.isMobileType" v-model:visible="ImgVisible" :images="[urls + props.info.value]">
  </t-image-viewer>
  <van-image-preview :show-index="false" v-else v-model:show="ImgVisible" :images="[urls + props.info.value]">
  </van-image-preview>
  <div class="outline-parent jy-style-height border-hover-style outline-style2">
    <div class="Showroom-parent" v-if="props.info.digitalShowroom">
      <digitalShowroomIcon :url="props.info.digitalShowroom" :id="props.info.id" />
    </div>
    <div
      class="outline-parent-bg"
      :style="{
        backgroundImage: `url(${publicUrls + 'free/style4/Level1outlineStyle5Bg.webp'})`,
        padding: !props.info.subTitle && !props.info.value && !props.info.remarks ? '20px 0 0 214px' : '20px 0 0 23px',
      }"
    >
      <div
        class="title-box"
        v-if="props.info.text"
        :style="{
          backgroundImage: `url(${publicUrls + 'free/style4/Level1Style5TitleBg.png?imageView2/format/webp'})`,
        }"
      >
        {{ props.info.text }}
      </div>
      <div
        class="content-box"
        :class="{
          'content-box2': props.info.subTitle && props.info.value && props.info.remarks,
          'content-box3': !props.info.subTitle && !props.info.value && props.info.remarks,
        }"
        v-if="props.info.subTitle || props.info.value || props.info.remarks"
      >
        <p class="sub-title" v-if="props.info.subTitle">{{ props.info.subTitle }}</p>
        <div class="cover" @click="ImgVisible = true" v-if="props.info.value" :class="{ cover2: !props.info.remarks }">
          <div class="img-box">
            <img class="cover-img" :src="urls + props.info.value + '?imageView2/3/format/webp'" alt="" />
          </div>
        </div>
        <div class="remarks1" v-if="props.info.remarks">
          <TextMax
            :data="props.info.remarks"
            :infoData="props.info"
            :title="props.info.text"
            :row="props.info.value ? 5 : 8"
          ></TextMax>
        </div>
      </div>
    </div>
  </div>
</template>

<script lang="ts">
export default defineComponent({
  name: 'free4style5',
});
</script>
<script lang="ts" setup>
import { publicUrls, textType } from '@/utils/minxin';
import { getTextHtml } from '@/utils/minxin';
import { urls } from '@/utils/request/upload';
import { defineComponent, ref } from 'vue';
import TextMax from '@/freeComponents/textMode/TextMax.vue';
import { useProjectStore } from '@/store';
import digitalShowroomIcon from '@/freeComponents/unitdigitalShowroom/style4.vue';

const ImgVisible = ref(false);
const store = useProjectStore();

const props = defineProps({
  info: {
    type: Object,
  },
});

// 跳转全景链接
const open = (url: any) => {
  if (url) {
    window.open(url, '_blank');
  }
};
</script>

<style lang="less" scoped>
.outline-parent {
  position: relative;
  margin-right: 90px;
  margin-top: 0;
  margin-left: 120px;
}
.Showroom-parent {
  position: absolute;
  top: 20px;
  right: 45px;
  z-index: 21;
}
.outline-parent-bg {
  width: 505px;
  height: 100%;
  position: relative;
  z-index: 20;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  display: flex;
  // padding: 20px 0 0 23px;
}
.title-box {
  flex-shrink: 0;
  width: 68px;
  height: 539px;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fcffff;
  text-align: center;
  font-family: 'SourceHanSerifCN';
  font-size: 30px;
  font-style: normal;
  font-weight: 700;
  line-height: 32px; /* 106.667% */
  writing-mode: vertical-rl;
  text-orientation: upright;
  letter-spacing: 2px;
}
.content-box {
  height: 539px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-left: 30px;
}
.content-box2 {
  padding-top: 60px;
}
.content-box3 {
  justify-content: flex-start;
  padding-top: 104px;
  .remarks1 {
    margin: 0;
  }
}
.sub-title {
  flex-shrink: 0;
  width: 339px;
  color: #333;
  text-align: center;
  font-family: 'PingFang SC';
  font-size: 18px;
  font-style: normal;
  font-weight: 400;
  line-height: 28px; /* 155.556% */
  opacity: 0.8;
}
.cover {
  flex-shrink: 0;
  width: 334px;
  height: 224px;
  border: 1px solid #c4d1cc;
  background: #dbe0dd;
  box-shadow: 4px 4px 0px 0px #cbd3ce inset;
  margin-top: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  .img-box {
    width: 329px;
    height: 219px;
    flex-shrink: 0;
    overflow: hidden;
  }
  .cover-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: all 0.5s;
  }
  &:hover {
    .cover-img {
      transform: scale(1.2);
    }
  }
}
.cover2 {
  width: 335px;
  height: 325px;
  .img-box {
    width: 330px;
    height: 320px;
  }
}
.remarks1 {
  flex-shrink: 0;
  width: 339px;
  margin-top: 21px;
}
::v-deep .van-text-ellipsis {
  color: rgba(51, 51, 51, 0.8) !important;
  font-family: 'PingFang SC' !important;
  font-size: 16px !important;
  font-style: normal;
  font-weight: 400;
  line-height: 32px; /* 200% */
  opacity: 0.8;
}
::v-deep .van-text-ellipsis__action::before {
  color: #83b0b3 !important;
  font-family: 'PingFang SC' !important;
  font-size: 16px !important;
  font-style: normal;
  font-weight: 500;
  line-height: 32px;
  text-decoration: underline;
  text-underline-offset: 4px;
}
</style>
